package edu.hqu.demo.controller;

import edu.hqu.demo.pojo.Course;
import edu.hqu.demo.pojo.Selection;
import edu.hqu.demo.pojo.Student;
import edu.hqu.demo.service.CourseService;
import edu.hqu.demo.service.SelectionService;
import edu.hqu.demo.service.StudentSerivice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@Controller
public class SelectionShowController {
    @Autowired
    private SelectionService selectService;

    @Autowired
    private StudentSerivice studentSerivice;

    @Autowired
    private CourseService courseService;

    @RequestMapping("/getSelectInformation")
    public String getSelectInformation(String Sno, Model model){
        Student student = studentSerivice.getStudentInformation("1911112005");
        model.addAttribute("studentInfo",student);
        List<Course> courseList = courseService.getSelectedCourse("1911112005");
        model.addAttribute("courseInfo",courseList);
        return "selectionshow";
    }
}
